package xuegao.study.mall.admin.feign;

import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.*;
import xuegao.study.mall.common.api.CommonResult;
import xuegao.study.mall.common.dto.*;
import xuegao.study.mall.common.model.oms.OmsOrder;

import java.util.List;
@FeignClient(contextId = "order", name = "study-order-service", path = "/oms/order")
public interface OmsOrderClient {

    @ApiOperation("批量删除订单")
    @PostMapping(value = "/delete")
    CommonResult delete(@RequestParam("ids") List<Long> ids);

    @ApiOperation("批量关闭订单")
    @PostMapping(value = "/update/close")
    CommonResult close(@RequestParam("ids") List<Long> ids, @RequestParam String note);

    /**
     * 查询订单列表(由于Feign Get请求无法直接解析POJO参数,所以需要用@SpringQueryMap注解修饰)
     */
    @ApiOperation("查询订单列表")
    @GetMapping("/list")
    List<OmsOrder> list(@SpringQueryMap OmsOrderQueryParam queryParam,
                        @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
                        @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum);

    @ApiOperation("查询订单详情")
    @GetMapping(value = "/{id}")
    OmsOrderDetail detail(@PathVariable("id") Long id);

    @ApiOperation("修改订单费用信息")
    @PostMapping(value = "/update/moneyInfo")
    CommonResult updateMoneyInfo(@RequestBody OmsMoneyInfoParam param);

    @ApiOperation("修改收货人信息")
    @PostMapping(value = "/update/receiverInfo")
    CommonResult updateReceiverInfo(@RequestBody OmsReceiverInfoParam param);

    @ApiOperation("备注订单-后台")
    @PostMapping(value = "/update/note")
    CommonResult updateNote(@RequestParam("id") Long id,
                            @RequestParam("note") String note,
                            @RequestParam("status") Integer status);

    @ApiOperation("批量发货")
    @PostMapping("/update/delivery")
    CommonResult delivery(@RequestBody List<OmsOrderDeliveryParam> deliveryParamList);
}
